#version 450

layout(location=0) in vec3 a_Pos;
layout(location=1) in vec3 a_Normal;
layout(location=2) in vec2 a_Texcoord;

layout(set=0, binding=0) uniform UBO {
    mat4 projMat;
    mat4 viewMat;
    vec4 lightPos;
    vec4 viewPos;
    float lodBias;
} ubo;

layout(location=0) out vec3 v_Normal;
layout(location=1) out vec2 v_Texcoord;
layout(location=2) out vec3 v_LightVec;
layout(location=3) out vec3 v_ViewVec;
layout(location=4) out float v_LodBias;

void main() {
    vec4 worldPos = vec4(a_Pos, 1.0);
    gl_Position = ubo.projMat * ubo.viewMat * worldPos;
    v_Normal = a_Normal;
    v_Texcoord = a_Texcoord;
    v_LightVec = (ubo.lightPos - worldPos).xyz;
    v_ViewVec = (ubo.viewPos - worldPos).xyz;
    v_LodBias = ubo.lodBias;
}